Home:ALL Converter>httpUnit parse HTML in JAVA Android application Unable to resolve superclass

httpUnit parse HTML in JAVA Android application Unable to resolve superclass

Ask Time:2012-06-22T04:24:01         Author:Kees Koenen

Json Formatter

I'm trying to login to a website (using POST) and parsing some HTML. The login works (using jsoup), but when I try to parse a full page, the Inputstream buffer is not big enough to capture the entire page.

public String Test() throws Exception {

    Log.d(TAG, "-->>> STARTING TEST");
    WebConversation wc = new WebConversation();
    WebRequest     req = new GetMethodWebRequest( "http://www.meterware.com/testpage.html" );
    WebResponse   resp = wc.getResponse( req );
    // Log.d(TAG, "Response : " + resp.toString());
    return resp.toString();
}

I get an error :

06-21 20:12:52.945: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/javascript/ScriptingEngineImpl; (826)

All help is appreciated. Even if it means switching to a different parser.. (so far, i've tried jsoup, htmlutil and httputil).. all with their own difficulties. I found httpUtil is last updated in 2008 (?). Also, I need something that will be able to send cookies in the GET request..

My Log :

06-21 20:12:52.945: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/javascript/ScriptingEngineImpl; (826)
06-21 20:12:52.945: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/javascript/ScriptingEngineImpl;' failed
06-21 20:12:52.945: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/AbstractDomComponent; (279)
06-21 20:12:52.945: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/AbstractDomComponent;' failed
06-21 20:12:52.955: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/DomWindow; (201)
06-21 20:12:52.955: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/DomWindow;' failed
06-21 20:12:52.955: E/dalvikvm(414): Could not find class 'com.meterware.httpunit.dom.DomWindow', referenced from method com.meterware.httpunit.WebResponse.createDomScriptingHandler
06-21 20:12:52.955: W/dalvikvm(414): VFY: unable to resolve new-instance 211 (Lcom/meterware/httpunit/dom/DomWindow;) in Lcom/meterware/httpunit/WebResponse;
06-21 20:12:52.955: D/dalvikvm(414): VFY: replacing opcode 0x22 at 0x0006
06-21 20:12:52.989: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/javascript/ScriptingEngineImpl; (826)
06-21 20:12:52.989: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/javascript/ScriptingEngineImpl;' failed
06-21 20:12:53.006: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/AbstractDomComponent; (279)
06-21 20:12:53.006: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/AbstractDomComponent;' failed
06-21 20:12:53.015: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/NodeImpl; (201)
06-21 20:12:53.025: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/NodeImpl;' failed
06-21 20:12:53.025: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/DocumentImpl; (256)
06-21 20:12:53.035: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/DocumentImpl;' failed
06-21 20:12:53.045: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/HTMLDocumentImpl; (207)
06-21 20:12:53.045: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/HTMLDocumentImpl;' failed
06-21 20:12:53.045: E/dalvikvm(414): Could not find class 'com.meterware.httpunit.dom.HTMLDocumentImpl', referenced from method com.meterware.httpunit.WebResponse.createDomScriptingHandler
06-21 20:12:53.045: W/dalvikvm(414): VFY: unable to resolve check-cast 224 (Lcom/meterware/httpunit/dom/HTMLDocumentImpl;) in Lcom/meterware/httpunit/WebResponse;

/edit : I found this in the console-window. It gave me the clue to recompile. So I took the source of httpUnit and issued a 'jar cf * *'.. but when I added that jar to my project, I couldn't access it's methods?!

[2012-06-21 22:12:06 - Mobile] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.meterware.httpunit.Button$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

I tried to re-compile the .jar, but it didn't work. maybe I did something wrong in that process, would that be the solution?

Author:Kees Koenen,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/11146159/httpunit-parse-html-in-java-android-application-unable-to-resolve-superclass
yy